package gui;

import javax.swing.JButton;

import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;

import fiziksobject.*;
import physics.*;

public class ElectricFieldEditor extends ForcerEditor<electricField> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ElectricFieldEditor thiz = this;
	public ElectricFieldEditor(final electricField f) {
		super(f);
		final VectorModifier strength = new VectorModifier(f.getField());
		JButton ok = new JButton("Ok");
		add(strength);
		add(ok,BorderLayout.SOUTH);
		ok.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {
				f.setField(strength.getVector());
				WindowEvent wev = new WindowEvent(thiz, WindowEvent.WINDOW_CLOSING);
                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
			}
		});
	}
	
}
